Channels

interface Channels

This module is used to manage channels.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Interface defining callbacks for handling events related to Channels within the SDK.

Properties

Link copied to clipboard
abstract val allChannels: ArrayItemList<Channel>

Get all channels (user and others). The returned @object:ArrayItemList object allows you to listen changes.

Link copied to clipboard
abstract val allOwnedChannels: List<Channel>

Get all user's owned channels (locally).

Link copied to clipboard
abstract val allPendingChannels: List<Channel>

Get all pending channels (locally). User should accept or decline it with acceptChannelInvitation() or declineChannelInvitation().

Link copied to clipboard
abstract val allSubscribedChannels: List<Channel>

Get all user's subscribed channels (locally).

Link copied to clipboard
abstract val allUserChannels: List<Channel>

Get all user's channels (locally). You can also register a listener for listening changes : see registerChangeListener(...)

Link copied to clipboard
abstract val tenMostFollowedChannels: List<Channel>

Get ten most followed channels (locally).

Link copied to clipboard
abstract val tenMostRecentChannels: List<Channel>

Get ten most recent channels (locally).

Functions

Link copied to clipboard
abstract fun acceptChannelInvitation(channelId: String?, listener: RainbowListener<Unit, Unit>? = null)

Accept a Channel invitation.

Link copied to clipboard
abstract fun addUsersToChannel(channel: Channel, type: ChannelUserAffiliationType, contacts: ArrayList<IRainbowContact>, listener: RainbowListener<Pair<List<ChannelUser>, List<String>>, Unit>? = null)
abstract fun addUsersToChannel(channel: Channel, type: ChannelUserAffiliationType, contactsId: List<String>, listener: RainbowListener<Pair<List<ChannelUser>, List<String>>, Unit>? = null)

Adds users to a Channel with specific ChannelUserAffiliationType.

Link copied to clipboard
abstract fun browseChannels(categories: List<String>? = null, excludedCategories: List<String>? = null, subscribed: Boolean? = null, limit: Int = 100, offset: Int = 0, sortField: String = "subscribers_count", sortOrder: Int = -1, listener: RainbowListener<List<Channel>, Unit>? = null)

Browse channels.

Link copied to clipboard
abstract fun createChannel(name: String, topic: String? = null, mode: Channel.Mode? = null, category: String? = null, autoProvisioning: Boolean? = null, maxItems: Int? = null, listener: RainbowListener<Channel, Unit>? = null)

Create a closed company channel.

Link copied to clipboard
abstract fun createClosedChannel(name: String, description: String?, category: String?, autoProvisioning: Boolean, maxItems: Int, listener: RainbowListener<Channel, Unit>? = null)

Create a closed company channel.

Link copied to clipboard
abstract fun createItem(channel: Channel, channelItem: IChannelItem, listener: RainbowListener<String, Unit>? = null)

Adds ChannelItem to a Channel

Link copied to clipboard
abstract fun createPublicChannel(name: String, description: String?, category: String?, maxItems: Int, listener: RainbowListener<Channel, Unit>? = null)

Create a public company channel.

Link copied to clipboard
abstract fun declineChannelInvitation(channelId: String?, listener: RainbowListener<Unit, Unit>? = null)

Decline a Channel invitation.

Link copied to clipboard
abstract fun deleteAllUsersFromChannel(channel: Channel, listener: RainbowListener<Unit, Unit>? = null)

Removes all users from a Channel.

Link copied to clipboard
abstract fun deleteChannel(channel: Channel?, listener: RainbowListener<Unit, Unit>? = null)

Delete a channel

Link copied to clipboard
abstract fun deleteChannelAvatar(channelId: String?, listener: RainbowListener<Unit, Unit>? = null)

Delete the photo of the specified channel.

Link copied to clipboard
abstract fun deleteItem(channelId: String?, itemId: String?, listener: RainbowListener<Unit, Unit>? = null)

Deletes an ChannelItem from a Channel.

Link copied to clipboard
abstract fun deleteUsersFromChannel(channel: Channel, contacts: ArrayList<IRainbowContact>, listener: RainbowListener<Pair<List<ChannelUser>, List<String>>, Unit>? = null)
abstract fun deleteUsersFromChannel(channel: Channel, contactsId: List<String>, listener: RainbowListener<Pair<List<ChannelUser>, List<String>>, Unit>? = null)

Removes users from a Channel.

Link copied to clipboard
abstract fun fetchChannelItems(channel: Channel, limit: Int = 10, beforeDate: Date? = null, afterDate: Date? = null, listener: RainbowListener<List<IChannelItem>, Unit>?)

Fetch items from a specific channel

Link copied to clipboard
abstract fun fetchChannelsByCategory(category: String, excludedCategories: List<String>? = null, limit: Int = 100, offset: Int = 0, listener: RainbowListener<List<Channel>, Unit>? = null)

Fetch channels by categories

Link copied to clipboard
abstract fun fetchChannelsByDescription(topic: String?, listener: RainbowListener<List<Channel>, Unit>? = null)

Fetch channels by its description (from server).

Link copied to clipboard
abstract fun fetchChannelsByName(name: String?, listener: RainbowListener<List<Channel>, Unit>? = null)

Fetch channels by its name (from server).

Link copied to clipboard
abstract fun fetchLatestItems(limit: Int = 10, beforeDate: Date? = null, afterDate: Date? = null, listener: RainbowListener<List<IChannelItem>, Unit>?)

Fetch latest items from all subscribed channels

Link copied to clipboard
abstract fun fetchMostFollowedChannels(limit: Int = 100, offset: Int = 0, listener: RainbowListener<List<Channel>, Unit>? = null)

Fetch most followed channels

Link copied to clipboard
abstract fun fetchMostRecentChannels(limit: Int = 100, offset: Int = 0, listener: RainbowListener<List<Channel>, Unit>? = null)

Fetch most recent channels

Link copied to clipboard
abstract fun fetchReactionsForChannelItem(channel: Channel, channelItem: IChannelItem, reactionType: ReactionType? = null, limit: Int = 50, offset: Int = 0, listener: RainbowListener<ChannelItemReactions, Unit>? = null)

Fetch reactions from a given channel item with specified limit and offset.

Link copied to clipboard
abstract fun fetchUsers(channel: Channel, limit: Int = 100, offset: Int = 0, userTypes: List<ChannelUserAffiliationType>? = null, invitedUser: Boolean = false, listener: RainbowListener<List<ChannelUser>, Unit>? = null)

Fetch users from a given channel with specified limit and offset.

Link copied to clipboard
abstract fun fetchUsersByName(channel: Channel, name: String, limit: Int = 20, offset: Int = 0, listener: RainbowListener<List<ChannelUser>, Unit>? = null)

Fetch users matching given names (from server). The search is done on users firstName and lastName and provides channel affiliation information.

Link copied to clipboard
abstract fun getChannelById(channelId: String): Channel?

Get a @object:Channel from its id (locally).

Link copied to clipboard
abstract fun getChannelByName(channelName: String): Channel?

Get a @object:Channel by its name but only in the user channels (locally).

Link copied to clipboard
abstract fun markAllItemsAsRead(channel: Channel)

Mark all message items of the channel as read.

Link copied to clipboard
abstract fun muteChannel(channel: Channel?, listener: RainbowListener<Unit, Unit>? = null)

Mute a Channel (no PUSH notification will be received).

Link copied to clipboard
abstract fun registerChangeListener(changeListener: IItemListChangeListener?)

Register a listener for being notified about channels changes.

Link copied to clipboard

Registers an implementation of IChannelsListener to receive callbacks when the SDK notifies of a new event.

Link copied to clipboard
abstract fun removeUserReactionForChannelItem(channel: Channel, item: IChannelItem, listener: RainbowListener<IChannelItem, Unit>?)

Removes the user reaction of a channel item

Link copied to clipboard
abstract fun searchChannels(name: String? = null, topic: String? = null, categories: List<String>? = null, excludedCategories: List<String>? = null, subscribed: Boolean? = null, limit: Int = 100, offset: Int = 0, sortField: String = "name", sortOrder: Int = 1, listener: RainbowListener<List<Channel>, Unit>? = null)

Search channels.

Link copied to clipboard
abstract fun subscribeToChannel(channel: Channel, listener: RainbowListener<Channel, Unit>? = null)

Subscribe to a channel.

Link copied to clipboard
abstract fun unMuteChannel(channel: Channel?, listener: RainbowListener<Unit, Unit>? = null)

UnMute a Channel (PUSH notification will be received).

Link copied to clipboard
abstract fun unregisterChangeListener(changeListener: IItemListChangeListener?)

Unregister a listener for being notified about channels changes.

Link copied to clipboard

Unregisters a previously registered IChannelsListener, stopping callbacks for events.

Link copied to clipboard
abstract fun unsubscribeToChannel(channel: Channel, listener: RainbowListener<Unit, Unit>? = null)

Unsubscribe from a subscribed channel.

Link copied to clipboard
abstract fun updateChannel(channelId: String, name: String? = null, topic: String? = null, mode: Channel.Mode? = null, category: String? = null, maxItems: Int? = null, listener: RainbowListener<Channel, Unit>?)

Update a channel.

Link copied to clipboard
abstract fun updateItem(channel: Channel, itemId: String, channelItem: IChannelItem, listener: RainbowListener<String, Unit>? = null)

Updates a ChannelItem object inside a Channel

Link copied to clipboard
abstract fun updateUserReactionForChannelItem(channel: Channel, item: IChannelItem, reactionType: ReactionType?, listener: RainbowListener<IChannelItem, Unit>?)

Updates the user reaction of a channel item

Link copied to clipboard
abstract fun updateUsersToChannel(channel: Channel, type: ChannelUserAffiliationType, contacts: ArrayList<IRainbowContact>, listener: RainbowListener<Pair<List<ChannelUser>, List<String>>, Unit>? = null)
abstract fun updateUsersToChannel(channel: Channel, type: ChannelUserAffiliationType, contactsId: List<String>, listener: RainbowListener<Pair<List<ChannelUser>, List<String>>, Unit>? = null)

Updates users to a Channel with specific ChannelUserAffiliationType.

Link copied to clipboard
abstract fun uploadChannelAvatar(channelId: String?, feedAvatar: File?, listener: RainbowListener<Unit, Unit>? = null)

Upload channel avatar.